import * as THREE from 'three'

function getRandomInt (min, max) {
    return Math.floor(Math.random() * (max - min)) + min
}

function getDegree (radian) {
    return (radian / Math.PI) * 180
}

function getRadian (degrees) {
    return (degrees * Math.PI) / 180
}

function getPolarCoord (rad1, rad2, r) {
    const x = Math.cos(rad1) * Math.cos(rad2) * r
    const z = Math.cos(rad1) * Math.sin(rad2) * r
    const y = Math.sin(rad1) * r
    return new THREE.Vector3(x, y, z)
}

function normalizeVector2 (vector) {
    vector.x = (vector.x / document.body.clientWidth) * 2 - 1
    vector.y = - (vector.y / window.innerHeight) * 2 + 1
}


// 使用单个 export 语句导出所有函数
export { getRandomInt, getDegree, getRadian, getPolarCoord, normalizeVector2 }
